import request from '@/utils/request'

// 获取文章列表
export const articleGetchannelList = () => {
  return request.get('/my/cate/list')
}

// 添加分类接口
export const articleAddchannel = ({ cate_name, cate_alias }) => {
  return request.post('/my/cate/add', { cate_name, cate_alias })
}

// 编辑分类接口
export const articleEditChannel = ({ id, cate_name, cate_alias }) => {
  return request.put('/my/cate/info', { id, cate_name, cate_alias })
}

// 删除分类接口
export const artileDeleteChannel = (id) => {
  return request.delete('/my/cate/del', {
    params: {
      id
    }
  })
}

// 获取文章列表接口
export const articleGetlist = ({ pagenum, pagesize, cate_id, state }) => {
  return request.get('/my/article/list', {
    params: {
      pagenum,
      pagesize,
      cate_id,
      state
    }
  })
}

// 发布文章接口
export const articleAddService = (data) => {
  return request.post('/my/article/add', data)
}

// 获取文章详情
export const articleGetInfo = (id) => {
  return request.get('/my/article/info', {
    params: {
      id
    }
  })
}

// 更新文章
export const articleUpdateInfo = (data) => {
  return request.put('/my/article/info', data)
}

// 删除文章
export const articleDelete = (id) => {
  return request.delete('/my/article/info', {
    params: {
      id
    }
  })
}